package com.jiandian.zh.api.web.config;

import com.jiandian.zh.api.common.dto.BaseResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author lik
 * 全局异常处理器
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public BaseResult error(Exception e){
        e.printStackTrace();
        return BaseResult.fail("网络错误");
    }
}
